<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout"
	layout:decorator="v2/layout">
  <head>
    <title>欢迎进入管理系统</title>
    <script type="text/javascript" th:inline="javascript">
    	var orgName = [[${session.user.name}]];
    	var title = [[${data.title}]];
    	var id = getParam("id");
    	
    	var type = 'BM';
    	var beginAt = new Date().DateAdd(-14).Format("yyyy-MM-dd");
    	var endAt = new Date().Format("yyyy-MM-dd");
    	var newType = 'ZT';
       	var findDate = function(beginAt, endAt){
       		var head = [];
       		if(type == 'BM'){
       			head = [{name:'报名人数（提交）', show:true, open:true},
       			        {name:'报名过审人数', show:true, open:false},
       			        {name:'报名成功人数', show:true, open:false},
       			        {name:'报名收费', show:false, open:false},
       			        {name:'已拒绝', show:false, open:false},
       			        {name:'待审核', show:false, open:false}];
       		} else if(type == 'ZP'){
       			head = [{name:'作品帖数（所有）', show:true, open:true},
       			        {name:'作品帖数（最终）', show:true, open:false},
       			        {name:'评委点评作品数', show:true, open:false},
       			        {name:'评委打分作品数', show:true, open:false}];
       		} else if(type == 'SF'){
       			head = [{name:'报名收费', show:true, open:true},
       			        {name:'报名成功人数', show:false, open:false},
       			        {name:'商品售卖数', show:false, open:false},
       			        {name:'商品收费', show:true, open:false},
       			     	{name:'投票数', show:false, open:false},
    			        {name:'投票收费', show:true, open:false}];
       			
       			
       		} else if(type == 'LL'){
       			head = [{name:'帖子浏览数', show:true, open:true}];
       		} else if(type == 'DK'){
       			head = [{name:'帖子打开数', show:true, open:true}];
       		} else if(type == 'HD'){
       			head = [{name:'互动总数', show:true, open:true},
       			        {name:'点赞数量', show:true, open:false},
       			        {name:'打分数量', show:true, open:false},
       			        {name:'点评数量', show:true, open:false},
       			        {name:'讨论数量', show:true, open:false},
       			        {name:'投票数量', show:true, open:false}];
       		}
       		//详细数据（表头加载）
       		$("#infoTableHead").loadData({list:head});
       		//详细数据（表格加载）
       		$.ajaxData({url:"list-detailStat", data:{id:id,beginAt:beginAt,endAt:endAt,type:type}, success:function(ret){
       			var x=[];
   				var yData = [];
       			$.each(ret, function(i,v){
       				x.unshift(v.date);
       				v.countHtml = '';
       				$.each(head, function(i2,v2){
       					v.countHtml += "<td>"+(v[v2.name] == null ? 0 : v[v2.name]) +"</td>"
       				});
       			});
       			$("#infoDetailCounts").loadData({counts:ret});
       			//echarts图形表格
       			$.each(head, function(i,v){
       				if(v.show){
   	    				var show = (i==0?true:false);
   	    				var headData = {name:v.name,show:v.open,data:[]};
   	    				$.each(ret, function(i2,v2){
   	    					var count = (v2[v.name]==null?0:v2[v.name])
   	    					headData.data.unshift(count)
   	       				});
   	    				yData.push(headData);
       				}
       			})
      				$("#echarts").echartsLine({xData:x, yData:yData});
       		}});
       	};
        
       	var export_execl = function(){
       		location.href='list-detailStatExport?type='+type+'&id='+id+'&beginAt='+(beginAt==null?'':beginAt)+'&endAt='+(endAt==null?'':endAt);
       	}
       	
       	var findCountByType = function(that, type){
       		$("#statCount .stat-group").removeClass("active");
			$(that).addClass("active");
			this.type = type;
			findDate(beginAt, endAt);
       	}
       	
      	//新闻
       	var findNewByType = function(that, type){
      		if(that != null){
      			$(that).parent().find(".info-title").removeClass("active");
      			$(that).addClass("active");
      		}
    		$.ajaxData({url:"list-detailNew",data:{evaluateId:id,type:type,size:4},success:function(ret){
    			$.each(ret.content, function(i,v){
        			v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm");
        		});
    			ret.type = type;
    			$("#listDetailNew").loadData(ret);
    		}})
       	}
    	$(function(){
    		setMenu(title);
    		
    		$("#listDetailNewHref").loadData({id:id});
    		$.setData({id:id});
    		
    		
    		findDate(beginAt, endAt);
    		$.ajaxData({url:"list-count",data:{evaluateId:id},success:function(data){
    			data.applyCount = (data.applyCount==null?0:data.applyCount)
    			data.dayApplyCount = (data.dayApplyCount==null?0:data.dayApplyCount)
    			data.blogCount = (data.blogCount==null?0:data.blogCount)
    			data.dayBlogCount = (data.dayBlogCount==null?0:data.dayBlogCount)
    			data.moneyCount = (data.moneyCount==null?0:data.moneyCount)
    			data.dayMoneyCount = (data.dayMoneyCount==null?0:data.dayMoneyCount)
    			data.lookCount = (data.lookCount==null?0:data.lookCount)
    			data.dayLookCount = (data.dayLookCount==null?0:data.dayLookCount)
    			data.openCount = (data.openCount==null?0:data.openCount)
    			data.dayOpenCount = (data.dayOpenCount==null?0:data.dayOpenCount)
    			data.hdCount = (data.hdCount==null?0:data.hdCount)
    			data.dayHDCount = (data.dayHDCount==null?0:data.dayHDCount)
    			$("#indexCount").loadData(data);
    		}})
    		
    		$.ajaxData({url:"list-detailYunYing",data:{evaluateId:id},success:function(data){
    			data.totalPrice = (data.totalPrice==null?0:data.totalPrice)
    			data.otherTotalPrice = (data.otherTotalPrice==null?0:data.otherTotalPrice)
    			data.id=id;
    			$("#listDetailYunYing").loadData(data);
    			$.setData(data);
    		}})
    		
    		
    		//备注
    		$.ajaxData({url:"list-detailDemo",data:{evaluateId:id,size:4},success:function(ret){
    			$.each(ret.content, function(i,v){
        			v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm");
        		});
    			ret.id=id;
    			$("#listMemo").loadData(ret);
    		}})
    		
    		
    		
    		
    		$("#listPage").page({url:"list-detailList", success:function(ret){
      			$.each(ret.obj.content, function(i,v){
        			v.createdAt = new Date(v.createdAt).Format("yyyy-MM-dd HH:mm");
        		});
      			$("#list").loadData({content:ret.obj.content,orgName:orgName});
      		}});
    		
    		findNewByType(null, newType);
    		
    		$("#listStatDate").showDate({beginAt:beginAt,endAt:endAt,success:function(ret){
    			findDate(ret.beginAt, ret.endAt);
    		}});
    		
    		$("#day li[data-day]").click(function(){
    			var day = $(this).data("day");
    			$("#day li").removeClass("active");
    			$(this).addClass("active");
    			if(day != ''){
    				beginAt = new Date().DateAdd(-day).Format("yyyy-MM-dd");
    				endAt = new Date().Format("yyyy-MM-dd");
    			} else {
    				beginAt = null;
    				endAt = null;
    			}
    			findDate(beginAt, endAt);
    		});
    		
    		$("#rcyy").loadData();
    	});
    </script>
    <style>

    </style>
  </head>
  <body>
    <div layout:fragment="content">
    	<div class="info-row">
    	<div class="info-box col-38">
	    	<div class="info">
		    	<div class="info-top">
		    		<div class="info-title">比赛Id: <span th:text="${data.id}"></div>
		    		<div class="info-btn">
		    			<a href="#"></a>
		    		</div>
		    	</div>
		    	<div class="info-tag-cont hinfo1">
			    	<div class="a_eval">
						<div class="a_eval-left"><img class="a_eval-img" th:src="${data.coverUrl}"/></div>
						<div class="a_eval-right">
							<div class="a_eval-title"><strong th:text="${data.title}">#{data.title}#</strong></div>
							<div class="a_eval-desc">
	                 					<span class="a_eval-label">地点：</span>
	                 					<span class="a_eval-text" th:text="${data.area}">#{data.area}#</span>
	                 				</div>
	                 				<div class="a_eval-desc">
	                 					<span class="a_eval-label">时间：</span>
	                 					<span class="a_eval-text" th:text="${data.timeInList}">#{data.timeInList}#</span>
	                 				</div>
	                				<div class="a_eval-desc">
	                					<span class="a_eval-label">主办方：</span>
	                			<span class="a_eval-text" th:text="${session.user.name}">#{orgName}#</span>
	                		</div>
	                 		<div class="a_eval-desc">
	                 			<span class="a_eval-label">报名费：</span>
	                 			<span class="a_eval-text" th:text="${data.charge}">#{data.charge}#</span>
	                 		</div>
	                 	</div>
	               	</div>
		    	</div>
	    	</div>
    	</div>
    	<div class="info-box col-38">
		    <div class="info">
		    	<div class="info-top">
		    		<div class="info-title">重要事项</div>
		    		<div class="info-btn">
		    			<a href="#"></a>
		    		</div>
		    	</div>
		    	<div class="info-tag-cont hinfo1">
		    		<div class="info-tag-box">
		    			<div class="info-tag">
		    				<label class="info-tag-label">主办方</label>
		    				<div class="info-tag-t">
		    					<span class="info-tag-l"><i class="info-alert info-alert-success"></i></span>
		    					<span class="info-tag-text">-</span>
		    				</div>
		    			</div>
		    		</div>
		    		
		    		<div class="info-tag-box">
		    			<div class="info-tag">
		    				<label class="info-tag-label">客服私信</label>
		    				<div class="info-tag-t">
		    					<span class="info-tag-l"><i class="info-alert info-alert-success"></i></span>
		    					<span class="info-tag-text">-</span>
		    				</div>
		    			</div>
		    		</div>
		    		<div class="info-tag-box">
		    			<div class="info-tag">
		    				<label class="info-tag-label">比赛阶段</label>
		    				<div class="info-tag-t">
		    					<span class="info-tag-l"><i class="info-alert info-alert-success"></i></span>
		    					<span class="info-tag-text">-</span>
		    				</div>
		    			</div>
		    		</div>
		    		<div class="info-tag-box">
		    			<div class="info-tag">
		    				<label class="info-tag-l info-tag-label">评委人数</label>
		    				<div class="info-tag-t">
		    					<span class="info-tag-l"><i class="info-alert info-alert-success"></i></span>
		    					<span class="info-tag-text"><a data-wyx-href="list-detailJury?id={id}" data-wyx-text="{juryCount}">1</a></span>
		    				</div>
		    			</div>
		    		</div>
		    		
		    		<div class="info-tag-box">
		    			<div class="info-tag">
		    				<label class="info-tag-l info-tag-label">财务管理</label>
		    				<div class="info-tag-t">
		    					<span class="info-tag-l"><i class="info-alert info-alert-success"></i></span>
		    					<span class="info-tag-text">-</span>
		    				</div>
		    			</div>
		    		</div>
		    		<div class="info-tag-box">
		    			<div class="info-tag">
		    				<label class="info-tag-l info-tag-label">新闻公告</label>
		    				<div class="info-tag-t">
		    					<span class="info-tag-l"><i class="info-alert info-alert-warning"></i></span>
		    					<span class="info-tag-text">-</span>
		    				</div>
		    			</div>
		    		</div>
		    	</div>
	    	</div>
    	</div>
    	
    	<div class="info-box col-24">
	    	<div class="info">
	    		<script id="listMemo" type="text/template">
		    	<div class="info-top">
		    		<div class="info-title">日程备忘</div>
		    		<div class="info-btn">
		    			<a href="/org/evaluate/memo/init?id=#{id}#&flgs=1">更多</a>
		    		</div>
		    	</div>
		    	
			    	<div class="info-tag-cont hinfo1">
			    		#for(memo:content)#
						<div class="info-f">
			    			<span class="info-f-date">#{memo.createdAt}#</span>
			    			<span class="info-f-text">#{memo.context}#</span>
			    		</div>
						#endfor#
			    	</div>
				</script>
	    	</div>
    	</div>
    	</div>
    	<div class="info-row">
    	<div class="info-box col-50">
	    	<div class="info h200">
		    	<div class="info-top">
		    		<div class="info-title">日常运营</div>
		    		<div class="info-btn">
		    			<a href="#"></a>
		    		</div>
		    	</div>
		    	<script id="listDetailYunYing" type="text/template">
			    	<div class="info-tag-cont hinfo2">
			    		<div class="info-tag3">
			    			<div class="info-tag3-icon">
								<a href="list-detailApply?id=#{id}#">
			    				<i class="info-tag3-ren"></i>
								<span class="info-tag3-label">报名管理</span>
								</a>
			    			</div>
			    			<div class="info-tag3-cont">
			    				<div class="info-tag3-t">
			    					<span class="info-tag3-text">报名人数</span>
			    					<span class="info-tag3-count"> #{applyCount}#</span>
			    				</div>
			    				<div class="info-tag3-t">
			    					<span class="info-tag3-text">作品人数</span>
			    					<span class="info-tag3-count">#{blogCount}#</span>
			    				</div>
			    			</div>
			    		</div>
			    		
			    		<div class="info-tag3">
			    			<div class="info-tag3-icon">
								<a href="list-detailPass?id=#{id}#">
			    				<i class="info-tag3-jj"></i>
								<span class="info-tag3-label">晋级管理</span>
								</a>
			    			</div>
			    			<div class="info-tag3-cont">
			    				<div class="info-tag3-t">
			    					<span class="info-tag3-text">晋级人数</span>
			    					<span class="info-tag3-count"> #{jjCount}#</span>
			    				</div>
			    				<div class="info-tag3-t">
			    					<span class="info-tag3-text">候选人数</span>
			    					<span class="info-tag3-count">#{hxCount}#</span>
			    				</div>
			    			</div>
			    		</div>
			    		
			    		<div class="info-tag3">
			    			<div class="info-tag3-icon">
								<a href="list-detailOrder?id=#{id}#">
			    				<i class="info-tag3-qz"></i>
								<span class="info-tag3-label">收费管理</span>
								</a>
			    			</div>
			    			<div class="info-tag3-cont">
			    				<div class="info-tag3-t">
			    					<span class="info-tag3-text">报名收费</span>
									<span class="info-tag3-count">#{totalPrice}#</span>
			    				</div>
			    				<div class="info-tag3-t">
			    					<span class="info-tag3-text">商品收费</span>
									<span class="info-tag3-count">#{otherTotalPrice}#</span>
			    				</div>
			    			</div>
			    		</div>
			    	</div>
				</script>
	    	</div>
    	</div>
    	
    	<div class="info-box col-50">
	    	<div class="info">
		    	<div class="info-top">
		    		<div class="info-title active" onclick="findNewByType(this, 'ZT')"><a href="javascript:void(0)">文章</a></div>
		    		<div class="info-title" onclick="findNewByType(this, 'NOTICE')"><a href="javascript:void(0)">公告</a></div>
		    		<div class="info-title" onclick="findNewByType(this, 'ZPQ')"><a href="javascript:void(0)">照片墙</a></div>
		    		<div class="info-title" onclick="findNewByType(this, 'NEW')"><a href="javascript:void(0)">外链</a></div>
		    		<div class="info-btn">
		    			<script id="listDetailNewHref" type="text/template">
		    			<a href="list-detailNews?evaluateId=#{id}#">进入</a>
						</script>
		    		</div>
		    	</div>
		    	<script id="listDetailNew" type="text/template">
						#if(type!='NOTICE')#
			    		<div class="info-tag4 hinfo2">
							#for(data:content)#
			    			<div class="info-tag4-cont">
			    				<span class="info-tag4-time">#{data.createdAt}#</span>
			    				<span class="info-tag4-text">#{data.title}#</span>
			    			</div>
							#endfor#
			    		</div>
						#endif#

						#if(type=='NOTICE')#
						<div class="info-tag5 hinfo2">
							#for(data:content)#
			    			<div class="info-tag5-cont">
			    				<div class="info-tag5-text">
			    					<label class="info-tag5-label"><span class="info-tag5-l-text">公告</span></label>
									#{data.content}#
								</div>
			    				<div class="info-tag5-time">#{data.createdAt}#</div>
			    			</div>
							#endfor#
			    		</div>
						#endif#
			    </script>
	    	</div>
    	</div>
    	</div>
    	<div class="info info-full">
    		<div class="stat">
	            <div class="stat-top">
	                <span class="stat-title"><strong>关键数据</strong></span>
	            </div>
	            <div class="stat-content">
	            	<script type="text/template" id="indexCount">
	            	<div class="stat-row stat-btn" id="statCount">
		                <div class="stat-group active" onclick="findCountByType(this, 'BM')">
		                    <div class="stat-group-title">报名人数</div>
		                    <div class="stat-group-count"><strong>#{applyCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayApplyCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group" onclick="findCountByType(this, 'ZP')">
		                    <div class="stat-group-title">作品帖数</div>
		                    <div class="stat-group-count"><strong>#{blogCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayBlogCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group" onclick="findCountByType(this, 'SF')">
		                    <div class="stat-group-title">收费总数(含已退赛)</div>
		                    <div class="stat-group-count"><strong>#{moneyCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayMoneyCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group" onclick="findCountByType(this, 'LL')">
		                    <div class="stat-group-title">浏览总数</div>
		                    <div class="stat-group-count"><strong>#{lookCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayLookCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group" onclick="findCountByType(this, 'DK')">
		                    <div class="stat-group-title">打开总数</div>
		                    <div class="stat-group-count"><strong>#{openCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayOpenCount}#</span>
		                    </div>
		                </div>
		                <div class="stat-group" onclick="findCountByType(this, 'HD')">
		                    <div class="stat-group-title">互动总数</div>
		                    <div class="stat-group-count"><strong>#{hdCount}#</strong></div>
		                    <div class="stat-group-day">
		                        <label>今日</label>
		                        <span>#{dayHDCount}#</span>
		                    </div>
		                </div>
	                </div>
	                </script>
	            </div>
	
	        </div>
    	</div>
    	
    	<div class="c_tab">
   			<ul class="c_tab-list" id="day">
   				<li data-day="7">7天</li>
   				<li data-day="14" class="active">14天</li>
   				<li data-day="30">30天</li>
   				<li data-day="">全部</li>
   				<li class="c_tab-date">
   					<div id="listStatDate"></div>
   					
   				</li>
   			</ul>
    	</div>
    	
		<div class="info info-full">
			<div style="height: 300px;" id="echarts"></div>
			
				<div class="detail-table">
       				<h4 class="detail-table-title">
						详细数据
						<span class="detail-table-more">
							<a href="javascript:export_execl();"><i class="icon_export"></i>导出CSV</a>
						</span>
					</h4>
				    <div class="table_list">
		               <div class="table-overflow">
		                   <table class="table">
		                       <thead>
			                       <tr>
	                                 <th>日期</th>
	                                   <script type="text/template" id="infoTableHead">
									   #for(data:list)#
										 <th>#{data.name}#</th>
									   #endfor#
								       </script>
			                       </tr>
		                       </thead>
		                       <tbody>
		                       <script type="text/template" id="infoDetailCounts">
								#for(data:counts)#
									<tr>
										<td>#{data.date}#</td>
										#{data.countHtml}#
									</tr>
								#endfor#
								</script>
		                     </tbody>
		                 </table>
		             </div>
		          </div>
	          </div>
			
    	</div>
    	
    </div>
  </body>
</html>